package jy.game.components.shop;


import jy.game.components.item.JyItem;
import jy.game.tools.JyResourceManager;
import jy.game.tools.Tools;
import wx.xml.simpleframework.xml.Attribute;
import wx.xml.simpleframework.xml.Root;

@Root(name = "sale")
public class JyShopSale {

    @Attribute public String name;
    @Attribute public int    limit   = -1;
    @Attribute public int    yuanbao = -1;
    @Attribute public int    price;

    private int _price = -1;

    // (get) Token: 0x060004BF RID: 1215 RVA: 0x00031BE0 File Offset: 0x0002FDE0
    // (set) Token: 0x060004C0 RID: 1216 RVA: 0x0000485C File Offset: 0x00002A5C
    public int getPrice() {

        if (this._price == -1 && this.yuanbao == -1) {
            JyItem item = JyResourceManager.get(JyItem.class, this.name);
            return item.price;
        }
        if (this._price > 0) {
            return this._price;
        }
        return -1;
    }

    public void setPrice(int value) {
        this._price = value;
    }

    public String GetPriceInfo() {
        String text = this.name + ",价格:";
        if (this.getPrice() > 0) {
            text = text + " 银两 " + this.getPrice();
        } else if (this.yuanbao > 0) {
            String text2 = text;
            text = Tools.concat(new String[]
                {
                    text2,
                    " <color='yellow'>元宝",
                    "" + this.yuanbao,
                    "</color>"
                });
        }
        return text;
    }
}